﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<CollegeWebsite.Models.Student>" %>
<%@ Import Namespace="CollegeWebsite.Models" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">

<style>
label{
    display: inline-block; float:left;line-height: 23px; margin-right: 20px
}


</style>
    <h2>Apply</h2>
  <% Html.EnableClientValidation(); %>
    <%= Html.ValidationSummary() %>

<
    <% using (Html.BeginForm()) {%>

 
<% var applyCourse = (Course) ViewData["Course"]; %>
<table id="table1" style="width:100%;border: solid 1px gray; padding:0px;border-collapse:collapse;word-wrap: normal">
        <tr>
            <td colspan="3" class="style2">
                <%= Html.Encode(applyCourse.Department.Faculty.FacultyName) %></td>
            <td class="style1">
            </td>
            <td class="style1">
            </td>
            <td class="style14" rowspan="3">
               <%= Html.Hidden("courseID",applyCourse.CourseID) %></td>
        </tr>
        <tr class="style7" style=" border-left: solid 1px gray;">
            <td class="style3">
                Code
            </td>
            <td class="style2">
                Level</td>
            <td class="style2">
                Faculty</td>
            <td class="style2">
                Capicity</td>
            <td class="style2" style="min-width: 70px">
                Fee (USD)</td>
        </tr>
        <tr style=" border-left: solid 1px gray;">
            <td class="style3">
               FDRG<%= Html.Encode(applyCourse.CourseID)%></td>
            <td>
               <%= Html.Encode(applyCourse.CourseName)%></td>
            <td class="style2">
                <%= Html.Encode(applyCourse.Department.DepartmentName)%></td>
            <td class="style2">
               <%= Html.Encode(applyCourse.CourseCapicity)%></td>
            <td class="style2">
               <%= Html.Encode(applyCourse.CourseFee)%> $</td>
        </tr>
    </table>




        <fieldset>
            <legend>Enter your infomation</legend>
            <div class="editor-label">
                <%= Html.LabelFor(model => model.StudentName) %>
            </div>
            <div class="editor-field">
                <%= Html.TextBoxFor(model => model.StudentName) %>
                <%= Html.ValidationMessageFor(model => model.StudentName) %>
            </div>
            
            <div class="editor-label">
                <%= Html.LabelFor(model => model.FatherName) %>
            </div>
            <div class="editor-field">
                <%= Html.TextBoxFor(model => model.FatherName) %>
                <%= Html.ValidationMessageFor(model => model.FatherName) %>
            </div>
            
            <div class="editor-label">
                <%= Html.LabelFor(model => model.MotherName) %>
            </div>
            <div class="editor-field">
                <%= Html.TextBoxFor(model => model.MotherName) %>
                <%= Html.ValidationMessageFor(model => model.MotherName) %>
            </div>
            
            <div class="editor-label">
                <%= Html.LabelFor(model => model.PIN) %>
            </div>
            <div class="editor-field">
                <%= Html.TextBoxFor(model => model.PIN) %>
                <%= Html.ValidationMessageFor(model => model.PIN) %>
            </div>
            <div class="description">(Passport:VNM-XXX-XXX-XXXXX)
            </div>
            
            
            <div class="editor-label">
                <%= Html.LabelFor(model => model.DateOfBirth) %>
            </div>
            <div class="editor-field">
                <%= Html.TextBoxFor(model => model.DateOfBirth) %>
                <%= Html.ValidationMessageFor(model => model.DateOfBirth) %>
            </div>
            <script type="text/javascript">
            jQuery('#PIN').mask('VNM-999-999-99999');
            jQuery('#DateOfBirth').mask('99/99/9999');
           jQuery('#DateOfBirth').datepicker({
                   dateFormat: "dd/mm/yy",
                   yearRange: "1980:2010",
                   changeMonth: true,
			changeYear: true 
               });

           function CheckPIN(pin) {
                $.post(
                        "<% = Url.Action("CheckPIN") %>", 
                        { PIN: $("#PIN").val() }, 
                        function(data) {
                            if(data == true) {
                            
                                $("#PIN").css("color", "red");
                                $("#PIN").next().removeClass('field-validation-valid').addClass('field-validation-error');
                                $("#PIN").next().html('<span>The PIN has been registered</span>');
                               
                                    
                            }
                            else {
                             
                                $("#PIN").css("color", "green");
                                $("#PIN").next().addClass('field-validation-valid').removeClass('field-validation-error');
                                $("#PIN").next().show().html('<span></span>');
                                
                                 if(pin == 'onSubmit') {
                                   $('.art-postcontent form').submit();
                                }
                            }
                            
                        });
           }
           
            $(document).ready(function() {
                $('#PIN').blur(function() {
                    CheckPIN();
                });
                $('#captcha').realperson();
            });
            
            
            </script>
            <div class="editor-label">
           
                <%= Html.LabelFor(model => model.Gender) %>
            </div>
            <div class="editor-field">
                <%= Html.RadioButtonFor(model => model.Gender,true, new{@checked="checked"}) %> <label for="Gender" style="">Male</label> <%= Html.RadioButtonFor(model => model.Gender,true,new{id="Female"}) %><label for="Female">Female</label>    
             <%= Html.ValidationMessageFor(model => model.Gender) %>
            </div>
            <div style="clear: both"></div>
            <div class="editor-label">
                <%= Html.LabelFor(model => model.ResidentialAddress) %>
            </div>
            <div class="editor-field">
                <%= Html.TextAreaFor(model => model.ResidentialAddress) %>
                <%= Html.ValidationMessageFor(model => model.ResidentialAddress) %>
            </div>
            
            <div class="editor-label">
                <%= Html.LabelFor(model => model.PermanentAddress) %>
            </div>
            <div class="editor-field">
                <%= Html.TextAreaFor(model => model.PermanentAddress) %>
                <%= Html.ValidationMessageFor(model => model.PermanentAddress) %>
            </div>
            
            <div class="editor-label">
                <%= Html.LabelFor(model => model.SupportDetails) %>
            </div>
            <div class="editor-field">
                <%= Html.TextAreaFor(model => model.SupportDetails) %>
                <%= Html.ValidationMessageFor(model => model.SupportDetails) %>
            </div>
            
              <div class="editor-label">
                <%= Html.LabelFor(model => model.Email) %>
            </div>
            <div class="editor-field">
                <%= Html.TextAreaFor(model => model.Email) %>
                <%= Html.ValidationMessageFor(model => model.Email) %>
            </div>
            
            
       
            
            <div>
            <%Html.RenderAction("StudentAddPreviousInfo", "StudentPreviousInfomation"); %>
            
            </div>
            
             <div class="editor-label">
               Enter code
            </div>
            <div class="editor-field" style="width: 300px">
                 <span id="captcha" ></span>
                 <input type="text" name="entercaptcha"/>
                 <%= Html.ValidationMessage("entercaptcha","Enter code above") %>
            </div>
            <p>
            
                
     <input type="button" onclick="return CheckPIN('onSubmit')"  value="Apply" style="margin: 0px auto 0px auto" />
            </p>
        </fieldset>

    <% } %>

   

</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="TitleContentPlaceHolder" runat="server">
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="ScriptIncludePlaceHolder" runat="server">
    <style type="text/css">
        .style1 { width: 143px; }
        .style2 { border-collapse: separate; }
        .style3 { width: 143px; border-collapse: separate; }
    </style>
</asp:Content>

<asp:Content ID="Content4" ContentPlaceHolderID="HeaderContentPlaceHolder" runat="server">
</asp:Content>

<asp:Content ID="Content5" ContentPlaceHolderID="MenuContentPlaceHolder" runat="server">
</asp:Content>

<asp:Content ID="Content6" ContentPlaceHolderID="Sidebar1ContentPlaceHolder" runat="server">
</asp:Content>

